package com.maychat.mapper;

import com.maychat.pojo.ChatSession;
import com.maychat.pojo.ChatSessionUser;
import com.maychat.pojo.extended.ChatSessionComb;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface ChatSessionUserMapper {

    List<ChatSessionComb> selectChatsByUid(String uid);

    @Insert("insert into chat_session values (#{sessionId}, #{lastMessage}, #{lastReceiveTime})")
    void insertChatSession(ChatSession chatSession);


    @Insert("insert into chat_session_user values (#{userId}, #{contactId}, #{sessionId}, #{contactName})")
    void insertChatSessionUser(ChatSessionUser chatSessionUser);

    void upsertChatSession(ChatSession chatSession);

    void upsertChatSessionUserMore(List<ChatSessionUser> chatSessionUsers);

    void updateChatSessionUserByContactId(ChatSessionUser update);

    void updateChatSessionBySessionId(ChatSession chatSession);
}
